import React, {Component, useEffect, useState} from 'react';
import axios from "axios";

//useEffect(处理副作用)

export default function App() {
    const [list, setlist] = useState('xiaoming')
    useEffect(() => {
        setlist(list.substring(0,1).toUpperCase()+list.substring(1))
    }, [list])//传空数组;依赖状态,空数组表示不依赖

    return (
        <div>
            <div>
                {list}

                <button onClick={()=>{
                    setlist('xixi')
                }}>click</button>
            </div>
        </div>
    )
}
